﻿using System;
using BlueLotus7.MetaWeblogUtil.Sina;
using BlueLotus7.MetaWeblogUtil.Sina.Contract;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using BlueLotus7.MetaWeblogUtil.Contract;

namespace UnitTest
{
    [TestClass]
    public class SinaBlog
    {
        SinaAgent agent = new SinaAgent("Your Account", "Password");
        string postId = string.Empty;

        [TestMethod]
        public void GetPost()
        {
            SinaPost post = agent.GetPost("81680e820100yyvc");
            Assert.IsTrue(!string.IsNullOrWhiteSpace(post.postid));
        }

        [TestMethod]
        public void AddPost()
        {
            SinaPost post = new SinaPost();
            post.title = "libarary test";
            post.description = "libarary test description";
            postId = agent.AddPost(post);

            Assert.IsTrue(!string.IsNullOrWhiteSpace(postId));
        }

        [TestMethod]
        public void GetCategories()
        {
            var categoryInfos = agent.GetCategories(string.Empty);

            Assert.IsTrue(categoryInfos != null && categoryInfos.Length > 0);
        }
    }
}
